//
//  AACell.m
//  ZhiBoYuan
//
//  Created by apple on 2018/4/16.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "AACell.h"
#import "BannerModel.h"

@interface AACell ()

@property (nonatomic, strong)SDCycleScrollView *cycleScrollView2;
@end

@implementation AACell



- (void)awakeFromNib {
    [super awakeFromNib];

    _imageHight.constant = screenWidth / 414 * 180;
    // 网络图片
    self.cycleScrollView2 = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, ScreenWidth, _imageHight.constant) delegate:self placeholderImage:[UIImage imageNamed:@"banner"]];
    self.cycleScrollView2.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
    //    cycleScrollView2.titlesGroup = titles;
    self.cycleScrollView2.currentPageDotColor = [UIColor whiteColor]; // 自定义分页控件小圆标颜色
    [self addSubview:self.cycleScrollView2];
    
}

- (void)setBannerList:(NSMutableArray *)bannerList{
    _bannerList = bannerList;
    NSMutableArray *imagesURLStrings = [NSMutableArray array];
    for (BannerModel *banner in bannerList) {
        [imagesURLStrings addObject:banner.app_img_url];
    }
    self.cycleScrollView2.imageURLStringsGroup = imagesURLStrings;
    
}


#pragma mark - SDCycleScrollViewDelegate
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    NSLog(@"---点击了第%ld张图片", (long)index);
    
    BannerModel *banner = self.bannerList[index];
    if (self.clickBanner) {
        self.clickBanner(banner);
    }
}




// 滚动到第几张图回调
// - (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index
// {
// NSLog(@">>>>>> 滚动到第%ld张图", (long)index);
// }


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
